/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sim.helpers.comparers;
import sim.coalitional.Node;
import sim.helpers.Helper;

/**
 *
 * @author artem
 */
public class NodeComparer implements java.util.Comparator<Node> {

    Node basis;
    Helper helper;

    public NodeComparer(Node node, Helper helper) {
        this.basis = node;
        this.helper = helper;
    }

    public int compare(Node a, Node b) {
        if (helper.distance(basis, a) > helper.distance(basis, b)) {
            return 1;
        } else if (helper.distance(basis, a) == helper.distance(basis, b)) {
            return 0;
        } else {
            return -1;
        }
    }
}
